.TH std::flat_map::keys 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::flat_map::keys \- std::flat_map::keys

.SH Synopsis
   const key_container_type& keys() const noexcept;  (since C++23)

   Return a constant reference to the adapted keys container. Equivalent to return
   c.keys;.

.SH Parameters

   \fI(none)\fP

.SH Return value

   The underlying keys container.

.SH Complexity

   Constant.

.SH Example


// Run this code

 #include <flat_map>
 #include <print>
 #include <type_traits>
 #include <vector>

 int main()
 {
     std::flat_map<int, double> adaptor{{1, 1.1}, {2, 2.2}, {3, 3.3}};

     // The default keys container is std::vector:
     static_assert(std::is_same_v<decltype(adaptor.keys()), const std::vector<int>&>);

     std::println("{}", adaptor.keys());
 }

.SH Output:

 [1, 2, 3]

.SH See also

   values direct access to the underlying values container
          \fI(public member function)\fP
